import dialogCommon from './dialog.vue';
import { createVNode, render } from 'vue'

export const commonDialog = (options: {
    render?: () => {},
    params: any
}) => {
    return new Promise((resolve, reject) => {
        const app = createVNode(dialogCommon, {
            ...options,
            resolve,
            reject
        });
        const mountNode = document.createElement("div");
        //render函数的作用就是将Notice组件的虚拟DOM转换成真实DOM并插入到mountNode元素里
        render(app, mountNode);
        //然后把转换成真实DOM的Notice组件插入到body里
        document.body.appendChild(mountNode);
    });
}
